<template>
	<!-- 地图 -->
	<!-- <map id="myMap" :show-location="showLocation" :longitude="longitude" :latitude="latitude" :circles="circles"
		:markers="markers" :scale="scale" :enable-3D="enable3D" :show-compass="showcompass"
		:enable-building="enablebuilding" style="width:100%; height: 300px;"></map> -->
	<swiper class="swiper-box" @change="change" :current="swiperDotIndex" indicator-dots indicator-color="#b8beff"
		indicator-active-color="#fff" :autoplay="true" interval="3000">
		<swiper-item v-for="(item ,index) in info" :key="index">
			<view class="swiper-item">
				<img :src="item.content" mode="aspectFit" class="swiperImage" />
			</view>
		</swiper-item>
	</swiper>
	<view class="container">
		<!-- 新增地址 -->
		<view class="add-address">
			新增地址
		</view>
		<!-- 发货地址 -->
		<view class="address-item" @tap="createOrder">
			<view class="receive-icon" style="background-color: #5064ff;">
				<text class="iconfont">发</text>
			</view>
			<view class="address-info">
				<view class="address-title">请填写发货地址</view>
				<view class="arrow-icon">
					<uni-icons type="right"></uni-icons>
				</view>
			</view>
		</view>
		<!-- 收货地址 -->
		<view class="address-item" @tap="createOrder">
			<view class="receive-icon">
				<text class="iconfont">收</text>
			</view>
			<view class="address-info">
				<view class="address-title">请填写收货地址</view>
				<view class="arrow-icon">
					<uni-icons type="right"></uni-icons>
				</view>
			</view>
		</view>
		<!-- 邀请新店下单 -->
		<img :src="$imgUrl + '/static/yaoqingxiadan.png'" alt="邀请下单" class="invite-item" @tap="goShare" />
	</view>
</template>

<script>
	// var amapFile = require('@/libs/amap-wx.130.js');
	export default {
		data() {
			return {
				info: [{
					content: this.$imgUrl + '/static/lunbo1.png'
				}, {
					content: this.$imgUrl + '/static/lunbo2.png'
				}],
				current: 0,
			}
		},
		onLoad() {

		},
		onShareAppMessage(res) {
			if (res.from === 'button') {
				console.log(res.target)
			}
			return {
				title: '上策食速达商家服务小程序让配送变得简单、高效、可靠，是您值得信赖的配送合作伙伴！',
			}
		},
		// 分享到朋友圈
		onShareTimeline() {
			return {
				title: '上策食速达商家服务小程序让配送变得简单、高效、可靠，是您值得信赖的配送合作伙伴！',
			}
		},
		methods: {
			// 获取地理位置
			// getLocation() {
			// 	var myAmapFun = new amapFile.AMapWX({
			// 		key: 'e11164077385a68815c61e4822707866'
			// 	});
			// 	myAmapFun.getRegeo({
			// 		//成功回调
			// 		success: (res) => {
			// 			console.log(res);
			// 			// this.params.lng = res[0].longitude;
			// 			// this.params.lat = res[0].latitude;
			// 			// uni.setStorageSync("longitude", res[0].longitude)
			// 			// uni.setStorageSync("latitude", res[0].latitude)
			// 			// uni.setStorageSync("city", res[0].regeocodeData.addressComponent.city)
			// 			// this.getlist()
			// 			// this.loadingPage = false
			// 		},
			// 		fail: (err) => {
			// 			// this.authorizeFailed()
			// 			// this.getlist()
			// 			// this.loadingPage = false
			// 		},
			// 	})
			// },
			goShare() {
				uni.navigateTo({
					url: "/pagesUser/share/share"
				})
			},
			// 创建订单
			createOrder() {
				uni.showToast({
					icon: 'none',
					title: '即将开放，敬请期待'
				})
				// uni.navigateTo({
				// 	url: "/pagesIndex/createOrder/createOrder"
				// })
			}
		}
	}
</script>

<style lang="scss">
	.swiper-box {
		width: 100%;
		height: 400rpx;

		.swiperImage {
			width: 100%;
			height: 420rpx;
		}
	}

	.add-address {
		width: 141rpx;
		height: 50rpx;
		border-radius: 109rpx 109rpx 109rpx 109rpx;
		border: 2rpx solid #DFDFDF;
		display: flex;
		justify-content: center;
		align-items: center;
		font-weight: 400;
		font-size: 25rpx;
		color: #999999;
		margin-bottom: 27rpx;
		margin-top: 40rpx;
	}

	.address-item {
		display: flex;
		align-items: center;
		padding: 20rpx;
		background-color: #f5f6f8;
		border-radius: 10rpx;
		margin-bottom: 20rpx;

		.receive-icon {
			width: 58rpx;
			height: 58rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			background-color: #ff7818;
			border-radius: 50%;
			margin-right: 20rpx;

			.iconfont {
				font-weight: bold;
				font-size: 29rpx;
				color: #FFFFFF;
			}
		}

		.address-info {
			width: 90%;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.address-title {
				font-size: 28rpx;
				color: #333333;
				font-weight: bold;
			}

			.address-detail {
				font-size: 28rpx;
				color: #999;
			}
		}

		.arrow-icon {
			width: 60rpx;
			height: 60rpx;
			display: flex;
			justify-content: center;
			align-items: center;

			.iconfont {
				font-size: 40rpx;
				color: #999;
			}
		}
	}

	.invite-item {
		width: 100%;
		height: 175rpx;
		margin-top: 50rpx;
	}
</style>